var vm = new Vue({
    el: '#app',
    data: {
        tableData: [{
            date: '',
            name: '',
            address: ''
        }],
        start:0,
        end:3,
        isNoMore:false,
        text:'记载更多'
    },
    mounted: function () {
        this.$nextTick(function () {
            this.getData();
        })
    },
    methods: {
        getData: function () {
            if(vm.isNoMore){
                return
            }
            var url = "data/table.json";
            console.log("start:"+vm.start+"，end:"+vm.end);
            vm.text = '加载中...';
            axios.get(url)
                .then(function (response) {
                    if (response.data.tableData == null || response.data.tableData.length < 1) {
                        vm.isNoMore = true;
                        vm.text = '没有更多数据了';
                    }else if(vm.start>8){
                        vm.isNoMore = true;
                        vm.text = '没有更多数据了';
                    }else {
                        vm.text = '加载更多';
                        vm.tableData = vm.tableData.concat(response.data.tableData);
                        vm.start+=3;vm.end+=3;
                    }
                })
                .catch(function (error) {
                    console.log(error);
                });
        }
    }
});

